package org.railage.server.services;

import java.util.List;

import org.railage.common.dto.PassengerDTO;
import org.railage.server.dao.PassengerDAO;
import org.railage.server.dao.PassengerDAOImpl;
import org.railage.server.entities.Passenger;

public class PassengerService {

	private PassengerDAO passengerDAO = new PassengerDAOImpl();

	public PassengerDTO[] getPassengersByTrip(Object obj) {
		List<Passenger> passengers = passengerDAO
				.getPassengersByTrip((Integer) obj);
		PassengerDTO[] passengersDTO = new PassengerDTO[passengers.size()];
		int i = 0;
		for (Passenger passenger : passengers) {
			passengersDTO[i] = passenger.toDTO();
			i++;
		}
		return passengersDTO;
	}

}
